﻿<template>
    <div v-cloak class="h100 hidden-x">
        <component is="style" />
        <van-pull-refresh v-model="isLoading" v-on:refresh="loadList" style="height:100%;overflow:auto;" :head-height="100">
            <div style="height:1px;"></div>
            <slot></slot>
            <div class="padding-tb-15 padding-lr-10">

                <van-button block v-on:click="loadList(true)" v-if="hasMore&&!!moreText" :disabled="!!isLoading" round>
                    {{!!isLoading?'正在加载...':moreText}}
                </van-button>
                <van-divider v-if="!hasMore&&!!nomoreText" class="size-12 color-999">{{nomoreText}}</van-divider>
            </div>
        </van-pull-refresh>
    </div>
</template>
<script>
    module = (function (hxt) {
        return {
            name: 'hxt.refresh',
            props: {
                hasMore: {
                    type: Boolean,
                    'default': function () {
                        return false;
                    }
                },
                value: {
                    type: Boolean,
                    'default': function () {
                        return false;
                    }
                },
                moreText: {
                    type: String,
                    default: function () {
                        return '点击查看更多'
                    }
                },
                nomoreText: {
                    type: String,
                    default: function () {
                        return '没有更多信息了'
                    }
                },
            },
            data: function () {
                return {
                    
                };
            },
            computed: {
                isLoading: {
                    get: function () {
                        return this.value;
                    },
                    set: function (val) {
                        this.$emit('input', val);
                    }
                }
            },
            activated: function () {

            },
            mounted: function () {

            },
            methods: {
                loadList: function (e) {
                    var _this = this;
                    _this.$emit('loadList', e);
                },
            },
            components: {

            }
        };
    })(window.$jscript.fn);
</script>
<style>
</style>